{"ast":null,"code":"import _slicedToArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";\n// Countdown\nvar timeUnits = [['Y', 1000 * 60 * 60 * 24 * 365], ['M', 1000 * 60 * 60 * 24 * 30], ['D', 1000 * 60 * 60 * 24], ['H', 1000 * 60 * 60], ['m', 1000 * 60], ['s', 1000], ['S', 1] // million seconds\n];\n\nexport function formatTimeStr(duration, format) {\n  var leftDuration = duration;\n  var escapeRegex = /\\[[^\\]]*]/g;\n  var keepList = (format.match(escapeRegex) || []).map(function (str) {\n    return str.slice(1, -1);\n  });\n  var templateText = format.replace(escapeRegex, '[]');\n  var replacedText = timeUnits.reduce(function (current, _ref) {\n    var _ref2 = _slicedToArray(_ref, 2),\n      name = _ref2[0],\n      unit = _ref2[1];\n    if (current.includes(name)) {\n      var value = Math.floor(leftDuration / unit);\n      leftDuration -= value * unit;\n      return current.replace(new RegExp(\"\".concat(name, \"+\"), 'g'), function (match) {\n        var len = match.length;\n        return value.toString().padStart(len, '0');\n      });\n    }\n    return current;\n  }, templateText);\n  var index = 0;\n  return replacedText.replace(escapeRegex, function () {\n    var match = keepList[index];\n    index += 1;\n    return match;\n  });\n}\nexport function formatCountdown(value, config) {\n  var _config$format = config.format,\n    format = _config$format === void 0 ? '' : _config$format;\n  var target = new Date(value).getTime();\n  var current = Date.now();\n  var diff = Math.max(target - current, 0);\n  return formatTimeStr(diff, format);\n}","map":{"version":3,"names":["timeUnits","formatTimeStr","duration","format","leftDuration","escapeRegex","keepList","match","map","str","slice","templateText","replace","replacedText","reduce","current","_ref","name","unit","includes","value","Math","floor","RegExp","len","length","toString","padStart","index","formatCountdown","config","target","Date","getTime","now","diff","max"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/antd/es/statistic/utils.js"],"sourcesContent":["// Countdown\nconst timeUnits = [['Y', 1000 * 60 * 60 * 24 * 365], ['M', 1000 * 60 * 60 * 24 * 30], ['D', 1000 * 60 * 60 * 24], ['H', 1000 * 60 * 60], ['m', 1000 * 60], ['s', 1000], ['S', 1] // million seconds\n];\n\nexport function formatTimeStr(duration, format) {\n  let leftDuration = duration;\n  const escapeRegex = /\\[[^\\]]*]/g;\n  const keepList = (format.match(escapeRegex) || []).map(str => str.slice(1, -1));\n  const templateText = format.replace(escapeRegex, '[]');\n  const replacedText = timeUnits.reduce((current, _ref) => {\n    let [name, unit] = _ref;\n    if (current.includes(name)) {\n      const value = Math.floor(leftDuration / unit);\n      leftDuration -= value * unit;\n      return current.replace(new RegExp(`${name}+`, 'g'), match => {\n        const len = match.length;\n        return value.toString().padStart(len, '0');\n      });\n    }\n    return current;\n  }, templateText);\n  let index = 0;\n  return replacedText.replace(escapeRegex, () => {\n    const match = keepList[index];\n    index += 1;\n    return match;\n  });\n}\nexport function formatCountdown(value, config) {\n  const {\n    format = ''\n  } = config;\n  const target = new Date(value).getTime();\n  const current = Date.now();\n  const diff = Math.max(target - current, 0);\n  return formatTimeStr(diff, format);\n}"],"mappings":";AAAA;AACA,IAAMA,SAAS,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAAA,CAChL;;AAED,OAAO,SAASC,aAAa,CAACC,QAAQ,EAAEC,MAAM,EAAE;EAC9C,IAAIC,YAAY,GAAGF,QAAQ;EAC3B,IAAMG,WAAW,GAAG,YAAY;EAChC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